<template>
  <el-container>
    <!--头部-->
    <el-header>
    </el-header>
    <el-main>
      <div class="posts_container">
        <el-row>
          <el-col :span="20" :offset="2">
            <div class="outline">
              <div
                class="content"
              >
                <div class="top" style="flow:right">
                    <el-row>
                      <el-col :span="3" :offset="21">
                        <a href="javascript:history.back(-1)"
                    >返回<i class="el-icon-back"></i
                  ></a>
                      </el-col>
                    </el-row>
                </div>
                <div class="title">
                  <h1>{{notice.title}}</h1>
                  <p>
                    <span v-if="notice.createTime!=null">发布日期：{{notice.createTime}}</span>&emsp;&emsp;&emsp;&emsp;&emsp;<span v-if="notice.author!=null">作者：{{notice.author}}</span>
                  </p>
                </div><br><br>
                <pre v-html="notice.content">
                          
                  </pre
                >
              </div>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-main>
    <el-footer>
    </el-footer>
  </el-container>
</template>

<script>
	import axios from 'axios';
	
export default {
  data() {
    return {
	 id:-1,
      notice:{}
    };
  },
  methods:{
	  getData(){
		  axios.get('/api/notice/findById', {
		  	params: {
		  		id: this.id //row为一条页面数据
		  	}
		  }).then(res => {
		  	this.notice = res.data.data;
			console.log(this.notice);
		  }).catch(err => {
		  	this.$message.error('删除数据失败')
		  })
	  }
  },
  components: {
  },
  created(){
      //this.id=this.$route.params;
	 this.id=this.$route.params.id;
	 this.getData();
    }
};
</script>

<style scoped>
.posts_container .outline {
  border: #0066ff 1px solid;
  padding: 60px 120px;
  min-height: 300px;
  background: white;
}
/* 标题样式 */
.posts_container .outline .title{
  text-align: center;

}
.posts_container .outline .title h1{
  color: #2b2b2b;
    font-size: 22px;
    line-height: 2em;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid #dedede;
    margin-bottom: 0.7em;
}

.posts_container .outline .title p{
  text-indent: 2em;
    line-height: 2em;
    margin-bottom: 15px;
    color: #999;
    margin: 20px 0 0;
}

/* 内容区样式 */
.posts_container .outline pre{
  border:0px;background:white;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 300px;
  
  text-indent: 2em;
  line-height: 2em;
  margin-bottom: 15px;
  color: #333;
  font-size: 17px;
  text-align: left;
}

a{
  margin: 10px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
</style>